//认领或者感感兴趣
function userDoTask(taskid,status){
	$.ajax({
		type: "POST",
		url: siteUrl+"index.php/task/do/ts-dotask",
		data: "taskid="+taskid+"&status="+status,
		beforeSend:function(){
		},
		success:function(result){
			if(result == '0'){
				art.dialog.open(siteUrl+'index.php/user/ajax/ts-login', {title: '登录'});
			}else if(result == '1'){
				art.dialog({
					icon: 'warning',
					content: '你已经认领了该任务^_^'
				});
			}else if(result == '2'){
				art.dialog({
					time: 3,
					icon: 'succeed',
					content: '认领任务成功^_^'
				});
				window.location.reload(); 
			}
		}
	});
}

//取消认领任务
function cancelTask(taskid,userid){
	art.dialog.confirm('确定不认领了吗？', function(){
	$.ajax({
		type: "POST",
		url: siteUrl+"index.php/task/do/ts-cancel",
		data: "taskid="+taskid+"&userid="+userid,
		beforeSend:function(){
		},
		success:function(result){
			if(result == '1'){
				art.dialog({
					time: 3,
					icon: 'succeed',
					content: '取消认领任务^_^'
				});
				window.location.reload(); 
			}
		}
	});
	});
}

//认领任务
function doTask(taskid,userid){
	$.ajax({
		type: "POST",
		url: siteUrl+"index.php/task/do/ts-do",
		data: "taskid="+taskid+"&userid="+userid,
		beforeSend:function(){
		},
		success:function(result){
			if(result == '1'){
				art.dialog({
					time: 3,
					icon: 'succeed',
					content: '认领任务成功^_^'
				});
				window.location.reload(); 
			}
		}
	});
}

